Handling request data with type safety in a remote service

ABSTRACT

Method and system are provided for handling request data with type safety in a remote service. The method includes providing a data structure, the data structure comprising a set of entries, each entry matching an incoming request type with a function for handling the request, the function defining a set of parameters. The method includes receiving an incoming request for a service from a remote client, wherein the request includes request data. The method includes using the data structure and identifying an entry for the incoming request by matching the request data to an incoming request type of an entry. The method includes converting the incoming request into a set of parameters using a software construct of the matching function identified in the entry, wherein the software construct comprises the matching function and associated in-scope local variables; and running the function using the converted parameters.

STATEMENT REGARDING PRIOR DISCLOSURES BY THE INVENTOR OR A JOINTINVENTOR

Aspects of the present invention have been disclosed by the Applicant,who obtained the subject matter disclosed directly from the inventors,in the product IBM® Swift, Kitura Version 2.0, made available to thepublic on Oct. 27, 2017. The following disclosure is submitted under 35U.S.C. § 102(b)(1)(A).

BACKGROUND

The present invention relates to handling request data in a remoteservice, and more specifically, to handling request data with typesafety in remote services such as microservices or web applications.Remote services such as microservices and web applications provideexposed web application programming interfaces (APIs) that allow theremote services to be invoked (i.e., called) by remote users (i.e.,callers) or other microservices and web applications. APIs may beprovided for protocols such as representational state transfer (REST),remote procedure calls (gRPC) and streaming text-oriented messagingprotocol (STOMP).

SUMMARY

According to an aspect of the present invention there is provided acomputer-implemented method for handling request data with type safetyin a remote service. The present invention may include providing a datastructure, wherein the data structure includes a set of entries, whereineach entry matches an incoming request type with a function for handlingthe request, and wherein the function defines a set of parameters. Thepresent invention may also include receiving an incoming request for aservice from a remote client, wherein the request includes request data.The present invention may then include using the data structure toidentify an entry for the incoming request by matching the request datato an incoming request type of an entry The present invention mayfurther include converting the incoming request into a set of parametersusing a software construct of the matching function identified in theentry, wherein the software construct comprises the matching functionand associated in-scope local variables. The present invention may alsoinclude running the function using the converted parameters.

According to another aspect of the present invention there is provided asystem for handling request data with type safety in a remote service.The present invention may include a processor and a memory configured toprovide computer program instructions to the processor to execute thefunction of the components. The present invention may also include adata structure providing component for providing a data structure,wherein the data structure includes a set of entries, wherein each entrymatches an incoming request type with a function for handling therequest, and wherein the function defines a set of parameters. Thepresent invention may then include an incoming request component forreceiving an incoming request for a service from a remote client,wherein the request includes request data; a data structure entryidentifying component for identifying an entry in the data structure forthe incoming request by matching the request data to an incoming requesttype of an entry. The present invention may further include a requestparameter converting component for converting the incoming request intoa set of parameters using a software construct of the matching functionidentified in the entry, wherein the software construct comprises thematching function and associated in-scope local variables. The presentinvention may also include a function running component for running thefunction using the converted parameters.

According to a further aspect of the present invention there is provideda computer program product for handling request data with type safety ina remote service. The present invention may include a computer readablestorage medium having program instructions embodied therewith and theprogram instructions executable by a processor to cause the processor toprovide a data structure, wherein the data structure includes a set ofentries, wherein each entry matches an incoming request type with afunction for handling the request, and wherein the function defines aset of parameters. The present invention may also include receiving anincoming request for a service from a remote client, wherein the requestincludes request data. The present invention may further include usingthe data structure to identify an entry for the incoming request bymatching the request data to an incoming request type of an entry. Thepresent invention may then include converting the incoming request intoa set of parameters using a software construct of the matching functionidentified in the entry, wherein the software construct comprises thematching function and associated in-scope local variables. The presentinvention may also include running the function using the convertedparameters.

BRIEF DESCRIPTION OF THE SEVERAL VIEWS OF THE DRAWINGS

The subject matter regarded as the invention is particularly pointed outand distinctly claimed in the concluding portion of the specification.The invention, both as to organization and method of operation, togetherwith objects, features, and advantages thereof, may best be understoodby reference to the following detailed description when read with theaccompanying drawings.

Preferred embodiments of the present invention will now be described, byway of example only, with reference to the following drawings in which:

FIG. 1 is a block diagram of an example embodiment of a system inaccordance with the present invention;

FIG. 2 is a flow diagram of an example embodiment of a method inaccordance with the present invention;

FIG. 3 is block diagram of an example embodiment of a system inaccordance with the present invention;

FIG. 4 is a block diagram of an embodiment of a computer system or cloudserver in which the present invention may be implemented;

FIG. 5 is a schematic diagram of a cloud computing environment in whichthe present invention may be implemented; and

FIG. 6 is a diagram of abstraction model layers of a cloud computingenvironment in which the present invention may be implemented.

It will be appreciated that for simplicity and clarity of illustration,elements shown in the figures have not necessarily been drawn to scale.For example, the dimensions of some of the elements may be exaggeratedrelative to other elements for clarity. Further, where consideredappropriate, reference numbers may be repeated among the figures toindicate corresponding or analogous features.

DETAILED DESCRIPTION

A method and system are provided for handling request data with typesafety in a remote service. As previously stated, remote services suchas microservices and web applications provide exposed web applicationprogramming interfaces (APIs) that allow the remote services to beinvoked (i.e., called) by remote users (i.e., callers) or othermicroservices and web applications. APIs may be provided for protocolssuch as representational state transfer (REST), remote procedure calls(gRPC) and streaming text-oriented messaging protocol (STOMP).

The APIs and their remote users may be loosely coupled. The caller maybe required to invoke the API using the correct protocol with thecorrect data, and the callee may be expected to validate the data andreject the request if it is found to be invalid. Additionally, thecallee may then transform the data from the transmission format intonative data structures understood by the programming language used forthe microservice.

This may differ from typical calling conventions for APIs in programminglanguages when the data is already in the correct format and the APIdefinition itself is used to validate that the caller is calling itcorrectly, either by the language compiler during development or by thelanguage runtime on execution. The use of loose coupling putssignificant effort onto the programmer to develop code that correctlyvalidates and transforms the data in order to avoid bugs and exposesecurity vulnerabilities.

There is an increased use of microservices, which require increasinglycomplex APIs and the transmission of more complex data. For example, theuse of JavaScript® Object Notation (JSON) (JavaScript and allJavaScript-based trademarks and logos are trademarks or registeredtrademarks of Oracle Corporation and/or its affiliates) as the standardfor the data format of the body request data is now being replaced withmore compressed, strongly-typed formats such as remote procedure callsand protocol buffers.

A number of attempts have been made to provide “type safe routing” byframeworks that do some form of conversion, and therefore validation, ofthe incoming API request data. However, each of these is limited in thatthey only deal with Uniform Resource Locator (URL) encoded parameters.For example, values that are embedded in the URL request itself such as/hello/{x}/from/{y}, where x and y are parameters. Here it is guaranteedthat the incoming parameters are strings, and therefore can be convertedto any “type” that already supports construction from a string or thatcan easily have a string constructor added.

Referring to FIG. 1, a block diagram 100 illustrates an exampleembodiment of the described system.

A server 110 may provide a remote service 130 to clients 160, forexample, the remote service 130 may be a microservice or a webapplication. Remote services 130 may expose application programminginterfaces (APIs) 131 that are invoked by remote clients 160 or by otherremote services.

The exposed APIs 131 may be increasingly complex and the APIs 131 mayonly be loosely coupled with the API callers. The caller may be requiredto invoke the API 131 by using the correct protocol and with the correctdata, then the remote service 130 must validate the data and reject arequest 170 if the data is not valid.

Use of loose coupling may put a significant amount of effort onto theprogrammer of remote services 130 to develop code that correctlyvalidates and transforms the data in order to avoid bugs and exposesecurity vulnerabilities.

Requests 170 sent by clients 160 using the remote service 130 mayinclude request data 171 that is complex and may be in compressed intostrongly-typed formats such as remote procedure calls (e.g., gRPC) andprotocol buffers. The request data 171 may include data types 172 withparameters 173 of the data types.

A data type is a classification data that may indicate how the data willbe used. Most programming languages support various types of data, forexample, real, integer or Boolean. A data type provides a set of valuesfrom which an expression (i.e., variable, function) may take its values.This data type may define the operations that can be done on the data,the meaning of the data, and the way values of that type can be stored.

A strongly-typed programming language may be one in which each type ofdata (e.g., an integer, a character, a hexadecimal or a packed decimal)is predefined as part of the programming language and all constants orvariables defined for a given program must be described with one of thedata types.

The described method and system may add support for type conversion andvalidation of the request data 171 in a request 170 from a client 160.This is particularly applicable to loosely coupled implementations usingstrongly-typed data.

The described system may provide a programmer interface system 150 foradding functions to a data structure 120 as required for functions 132with parameters 133 of exposed APIs 131 of the remote service 130.

The described system may also provide a request data handling system 140for handling incoming requests 170 to a remote service 130 from clients160 at run time using the data structure 120.

The data structure 120 may be provided in the form of a router tablewith a set of entries 121 and programmer-defined functions 122 defininga set of parameters 123. Each entry 121 may match an incoming requesttype 172 with a programmer-defined function 122 for handling the request170. Each entry 121 may relate to a same type and each function 122 andmay have the same function signature. Each function 122 may be areusable function that has a software construct 124 for handling eachfunction 122. The software construct 124 may include the matchingfunction 122 and may be associated with in-scope local variables. Thefunction 122 may be provided as a template for creating specializedfunctions at compile time that apply the concrete types used by callers.

The request data handling system 140 may convert incoming request data171 by using the software construct 124 of a function 122 for a datatype 172 to convert the request data 171 parameters 173 for running in afunction 132 of the API 131 of the remote service 130.

Referring to FIG. 2, a flow diagram 200 presenting an example embodimentof the described method of handling request data with type safety in aremote service.

At 201, the method may provide a data structure having a set of entries.Each entry matches an incoming request type with a user-created functionfor handling the request and each entry matches the function defining aset of parameters. Each entry may also relate to a same type and eachfunction may have the same function signature.

Then, at 202, the method may receive an incoming request for the remoteservice from a remote client. The request may contain request dataincluding a data type having parameters.

At 203, the method may match the request data to an incoming requestdata type of an entry in the data structure. At 204, the method mayidentify an entry for the incoming request. The mapping of the requestdata and the identification of an entry may map to a matching functionhaving a software construct identified in the data structure.

At 205, the method may convert the incoming request into a set ofparameters using the software construct of the matching function. Thesoftware construct may include a matching function and associatedin-scope local variables and may be a closure wrapping theprogrammer-define function stored data types.

Then, at 206, the method may run the function using the convertedparameters, thereby ensuring type safety of the request data.

The described method and system may address the particular challenges tobe overcome for strongly-typed languages, specifically avoiding the lossof type information. For example, a programmer of a remote service mayregister an exposed API that requests the body data to be converted to aspecific type as shown below.

Router.add(“POST:/api/v2/updateUser”, User.self) { user inupdateInDatabase(user) }

The “User” structure may inherit from a specific type or implement aspecific interface. The programmer may then request to be passed as aparameter into the provided function or closure (e.g., “Convertable”).

This API may then be stored, and subsequently called when a caller makesa call that matches the API, for example:

a POST request to “/api/v2/updateUser”.

However, this may pose a problem. First, the Router.add( ) functionneeds to be declared such that it accepts specific known types that itcan be called with (i.e., RequestConvertable). Second, the collectionthe API is stored in also needs to be declared such that it storesspecific known types (i.e., RequestConvertable).

At this point the strongly-typed information has been lost (i.e., typeerased) and replaced with RequestConvertable, and as such, thestrongly-typed information is the only type that can be passed into thefunction provided by the programmer.

The described method provides a mechanism for allowing programmers tospecify the concrete types of the body data that are accepted as part ofthe request from the caller and for the body data that is returned aspart of the response from the callee, avoiding the problems related totype erasure. A solution is provided regarding the loss of typeinformation when implementing type conversion and when validating therequest and response body data.

The mechanism centers around two approaches. The first approach may usegenerics or templates to define the router functions that a programmercan use to register an API. The second approach may use a softwareconstruct such as a closure wrapper around the programmer providedfunction that carries out the conversion of the body data. Thesecombined approaches may allow the information on the types to be usedfor the request and response body to be stored in the closure ratherthan as parameters, removing the need for the information on the typesto be used as parameters and, therefore, type loss.

Generics may allow reusable functions to be defined that work with anytypes, with the optional ability to apply constraints on the types ofdata that the function will work with. Typically, the compiler may usethis as a template and create multiple specialized functions at compiletime that apply the concrete types used by callers in the application.

Generics may allow reusable functions to be defined that work with anytypes. An example may include the function below.

func <T> myFunction(param: T) {  ... }

Here the generic placeholder ‘T’ can be of any type. Additionallyconstraints may be placed on ‘T’ to limit which types are allowed, forexample:

func <T: Codable> myFunction(param: T) {  ... }.

The above function applies a constraint that the placeholder ‘T’ canonly be used for types that implement Codable, which may allow APIs ofthe constrained specialized types to be used inside the function at ageneric level. However, those generics may be converted to concretetypes at compile time that retain the critical type information, forexample:

func add<I: Codable, O: Codable>(_route: String, input: I.Type, output:O.Type, handler: @escaping I -> O) { let data = {encoded data} let param= try decoder.decode(I.self, from: data) let result = try handler(param)return try encoder( ).encode(result) }.

The above function may require the input and output types to conform to“Codable”, which enables encode( ) and decode( ) to be called on it, butmay retain the concrete type information when the generic function isconverted into concrete functions by the compiler.

A limitation may occur when, for example, a programmer registers thecontents of the generic function and rather than executing the contents,the generic function may need to be stored so that the generic functionmay be called from an incoming request. The results of the limitationmay include a type loss during storage.

Therefore, a closure may be used to wrap the programmer's function andallow the knowledge of the concrete types requested by the programmer tobe held in the closure rather than as parameters, which would then losetheir types as they are stored. The wrapping closure then may only needto accept the incoming request body as data and only needs to return theresponse body data.

A closure (i.e., a lexical closure or a function closure) may include atechnique for implementing lexically scoped name binding in a languagewith first-class functions. Operationally, a closure may be a recordstoring a function together with an environment. The environment may bea mapping associating each free variable of the function (i.e.,variables that are used locally, but defined in an enclosing scope) withthe value or reference to which the name was bound when the closure wascreated. A closure, unlike a plain function, may allow the function toaccess those captured variables through the closure's copies of theirvalues or references, even when the function is invoked outside theirscope.

Taking this approach results in the following code:

typealias CodableClosure<I: Codable,O: Codable> = (I) throws -> O funcadd<I: Codable, O: Codable>(_route: String, codableHandler: @escapingCodableClosure<I, O>) { let invoker: (Data) throws -> Data = { data inlet param = try JSONDecoder( ).decode(I.self, from: data) let result =try codableHandler(param) return try JSONEncoder( ).encode(result) }codableRoutes.append((route, invoker)); }.

The above function may allow the router and the wrapper closure to bestored as they have consistent types, delegating the conversion betweenthe programmer's requested concrete types and the request/response bodydata to the wrapping closure, which can store the type data as part ofits own code.

This provides, for example, the programmer with a simple API interfacethat may require the programmer to use the following code to accept andreturn back the same “User” type data as shown below.

router.add(“/users”) { (user: User) -> User in return user }

This allows the framework to carry out the conversion and validation ofthe request body to the “User” type and to convert the “User” type intothe response body.

Referring to FIG. 3, a request data handling system 140 may be providedon a server 110. The server 110 may include at least one processor 301,a hardware module, or a circuit for executing the functions of thedescribed components which may be software units executing on the atleast one processor. Multiple processors running parallel processingthreads may be provided enabling parallel processing of some or all ofthe functions of the components. Memory 302 may be configured to providecomputer instructions 303 to the at least one processor 301 to carry outthe functionality of the components.

The request data handling system 140 may include a data structureproviding component 310 for providing a data structure 120. The datastructure 120 may include a set of entries 121, each entry 121 matchingan incoming request type with a function 122 for handling the request,the function 122 defining a set of parameters 123 and a softwareconstruct 124 for handling each function 122.

The request data handling system 140 may include an incoming requestcomponent 321 for receiving an incoming request for a service includingrequest data from a remote client. The software construct 124 maycomprise the matching function 122 and associated in-scope localvariables.

The request data handling system 140 may include a data structure lookup component 330 including a type matching component 331 and datastructure entry identifying component 332 for identifying an entry 121in the data structure 120 for the incoming request by matching therequest data to an incoming request type of an entry 121. The datastructure look up component 330 may include a request parameterconverting component 333 for converting the incoming request into a setof parameters using the software construct 124 of the matching functionidentified in the entry.

The request data handling system 140 may also include a function runningcomponent 322 for running the function using the converted parameters.

FIG. 4 depicts a block diagram of components of the computing device ofthe server 110 of FIG. 1, in accordance with an embodiment of thepresent invention. It should be appreciated that FIG. 4 provides only anillustration of one implementation and does not imply any limitationswith regard to the environments in which different embodiments may beimplemented. Many modifications to the depicted environment may be made.

Computing device can include one or more processors 402, one or morecomputer-readable RAMs 404, one or more computer-readable ROMs 406, oneor more computer readable storage media 408, device drivers 412,read/write drive or interface 414, and network adapter or interface 416,all interconnected over a communications fabric 418. Communicationsfabric 418 can be implemented with any architecture designed for passingdata and/or control information between processors (such asmicroprocessors, communications and network processors, etc.), systemmemory, peripheral devices, and any other hardware components within thesystem.

One or more operating systems 410, and application programs 411 such asthe remote services 130 are stored on one or more of the computerreadable storage media 408 for execution by one or more of theprocessors 402 via one or more of the respective RAMs 404 (whichtypically include cache memory). In the illustrated embodiment, each ofthe computer readable storage media 408 can be a magnetic disk storagedevice of an internal hard drive, CD-ROM, DVD, memory stick, magnetictape, magnetic disk, optical disk, a semiconductor storage device suchas RAM, ROM, EPROM, flash memory, or any other computer readable storagemedia that can store a computer program and digital information, inaccordance with embodiments of the invention.

Computing device can also include a R/W drive or interface 414 to readfrom and write to one or more portable computer readable storage media426. Application programs 411 on computing device can be stored on oneor more of the portable computer readable storage media 426, read viathe respective R/W drive or interface 414 and loaded into the respectivecomputer readable storage media 408.

Computing device can also include a network adapter or interface 416,such as a TCP/IP adapter card or wireless communication adapter.Application programs 411 on computing device can be downloaded to thecomputing device from an external computer or external storage devicevia a network (for example, the Internet, a local area network or otherwide area networks or wireless networks) and network adapter orinterface 416. From the network adapter or interface 416, the programsmay be loaded into the computer readable storage media 408. The networkmay comprise copper wires, optical fibers, wireless transmission,routers, firewalls, switches, gateway computers and edge servers.

Computing device can also include a display screen 420, a keyboard orkeypad 422, and a computer mouse or touchpad 424. Device drivers 412interface to display screen 420 for imaging, to keyboard or keypad 422,to computer mouse or touchpad 424, and/or to display screen 420 forpressure sensing of alphanumeric character entry and user selections.The device drivers 412, R/W drive or interface 414, and network adapteror interface 416 can comprise hardware and software stored in computerreadable storage media 408 and/or ROM 406.

The present invention may be a system, a method, and/or a computerprogram product at any possible technical detail level of integration.The computer program product may include a computer readable storagemedium (or media) having computer readable program instructions thereonfor causing a processor to carry out aspects of the present invention.

The computer readable storage medium can be a tangible device that canretain and store instructions for use by an instruction executiondevice. The computer readable storage medium may be, for example, but isnot limited to, an electronic storage device, a magnetic storage device,an optical storage device, an electromagnetic storage device, asemiconductor storage device, or any suitable combination of theforegoing. A non-exhaustive list of more specific examples of thecomputer readable storage medium includes the following: a portablecomputer diskette, a hard disk, a random access memory (RAM), aread-only memory (ROM), an erasable programmable read-only memory (EPROMor Flash memory), a static random access memory (SRAM), a portablecompact disc read-only memory (CD-ROM), a digital versatile disk (DVD),a memory stick, a floppy disk, a mechanically encoded device such aspunch-cards or raised structures in a groove having instructionsrecorded thereon, and any suitable combination of the foregoing. Acomputer readable storage medium, as used herein, is not to be construedas being transitory signals per se, such as radio waves or other freelypropagating electromagnetic waves, electromagnetic waves propagatingthrough a waveguide or other transmission media (e.g., light pulsespassing through a fiber-optic cable), or electrical signals transmittedthrough a wire.

Computer readable program instructions described herein can bedownloaded to respective computing/processing devices from a computerreadable storage medium or to an external computer or external storagedevice via a network, for example, the Internet, a local area network, awide area network and/or a wireless network. The network may comprisecopper transmission cables, optical transmission fibers, wirelesstransmission, routers, firewalls, switches, gateway computers and/oredge servers. A network adapter card or network interface in eachcomputing/processing device receives computer readable programinstructions from the network and forwards the computer readable programinstructions for storage in a computer readable storage medium withinthe respective computing/processing device.

Computer readable program instructions for carrying out operations ofthe present invention may be assembler instructions,instruction-set-architecture (ISA) instructions, machine instructions,machine dependent instructions, microcode, firmware instructions,state-setting data, configuration data for integrated circuitry, oreither source code or object code written in any combination of one ormore programming languages, including an object oriented programminglanguage such as Smalltalk, C++, or the like, and procedural programminglanguages, such as the “C” programming language or similar programminglanguages. The computer readable program instructions may executeentirely on the user's computer, partly on the user's computer, as astand-alone software package, partly on the user's computer and partlyon a remote computer or entirely on the remote computer or server. Inthe latter scenario, the remote computer may be connected to the user'scomputer through any type of network, including a local area network(LAN) or a wide area network (WAN), or the connection may be made to anexternal computer (for example, through the Internet using an InternetService Provider). In some embodiments, electronic circuitry including,for example, programmable logic circuitry, field-programmable gatearrays (FPGA), or programmable logic arrays (PLA) may execute thecomputer readable program instructions by utilizing state information ofthe computer readable program instructions to personalize the electroniccircuitry, in order to perform aspects of the present invention.

Aspects of the present invention are described herein with reference toflowchart illustrations and/or block diagrams of methods, apparatus(systems), and computer program products according to embodiments of theinvention. It will be understood that each block of the flowchartillustrations and/or block diagrams, and combinations of blocks in theflowchart illustrations and/or block diagrams, can be implemented bycomputer readable program instructions.

These computer readable program instructions may be provided to aprocessor of a general purpose computer, special purpose computer, orother programmable data processing apparatus to produce a machine, suchthat the instructions, which execute via the processor of the computeror other programmable data processing apparatus, create means forimplementing the functions/acts specified in the flowchart and/or blockdiagram block or blocks. These computer readable program instructionsmay also be stored in a computer readable storage medium that can directa computer, a programmable data processing apparatus, and/or otherdevices to function in a particular manner, such that the computerreadable storage medium having instructions stored therein comprises anarticle of manufacture including instructions which implement aspects ofthe function/act specified in the flowchart and/or block diagram blockor blocks.

The computer readable program instructions may also be loaded onto acomputer, other programmable data processing apparatus, or other deviceto cause a series of operational steps to be performed on the computer,other programmable apparatus or other device to produce a computerimplemented process, such that the instructions which execute on thecomputer, other programmable apparatus, or other device implement thefunctions/acts specified in the flowchart and/or block diagram block orblocks.

The flowchart and block diagrams in the Figures illustrate thearchitecture, functionality, and operation of possible implementationsof systems, methods, and computer program products according to variousembodiments of the present invention. In this regard, each block in theflowchart or block diagrams may represent a module, segment, or portionof instructions, which comprises one or more executable instructions forimplementing the specified logical function(s). In some alternativeimplementations, the functions noted in the blocks may occur out of theorder noted in the Figures. For example, two blocks shown in successionmay, in fact, be executed substantially concurrently, or the blocks maysometimes be executed in the reverse order, depending upon thefunctionality involved. It will also be noted that each block of theblock diagrams and/or flowchart illustration, and combinations of blocksin the block diagrams and/or flowchart illustration, can be implementedby special purpose hardware-based systems that perform the specifiedfunctions or acts or carry out combinations of special purpose hardwareand computer instructions.

Cloud Computing

It is to be understood that although this disclosure includes a detaileddescription on cloud computing, implementation of the teachings recitedherein are not limited to a cloud computing environment. Rather,embodiments of the present invention are capable of being implemented inconjunction with any other type of computing environment now known orlater developed.

Cloud computing is a model of service delivery for enabling convenient,on-demand network access to a shared pool of configurable computingresources (e.g., networks, network bandwidth, servers, processing,memory, storage, applications, virtual machines, and services) that canbe rapidly provisioned and released with minimal management effort orinteraction with a provider of the service. This cloud model may includeat least five characteristics, at least three service models, and atleast four deployment models.

Characteristics are as follows:

On-demand self-service: a cloud consumer can unilaterally provisioncomputing capabilities, such as server time and network storage, asneeded automatically without requiring human interaction with theservice's provider.

Broad network access: capabilities are available over a network andaccessed through standard mechanisms that promote use by heterogeneousthin or thick client platforms (e.g., mobile phones, laptops, and PDAs).

Resource pooling: the provider's computing resources are pooled to servemultiple consumers using a multi-tenant model, with different physicaland virtual resources dynamically assigned and reassigned according todemand. There is a sense of location independence in that the consumergenerally has no control or knowledge over the exact location of theprovided resources but may be able to specify location at a higher levelof abstraction (e.g., country, state, or datacenter).

Rapid elasticity: capabilities can be rapidly and elasticallyprovisioned, in some cases automatically, to quickly scale out andrapidly released to quickly scale in. To the consumer, the capabilitiesavailable for provisioning often appear to be unlimited and can bepurchased in any quantity at any time.

Measured service: cloud systems automatically control and optimizeresource use by leveraging a metering capability at some level ofabstraction appropriate to the type of service (e.g., storage,processing, bandwidth, and active user accounts). Resource usage can bemonitored, controlled, and reported, providing transparency for both theprovider and consumer of the utilized service.

Service Models are as follows:

Software as a Service (SaaS): the capability provided to the consumer isto use the provider's applications running on a cloud infrastructure.The applications are accessible from various client devices through athin client interface such as a web browser (e.g., web-based e-mail).The consumer does not manage or control the underlying cloudinfrastructure including network, servers, operating systems, storage,or even individual application capabilities, with the possible exceptionof limited user-specific application configuration settings.

Platform as a Service (PaaS): the capability provided to the consumer isto deploy onto the cloud infrastructure consumer-created or acquiredapplications created using programming languages and tools supported bythe provider. The consumer does not manage or control the underlyingcloud infrastructure including networks, servers, operating systems, orstorage, but has control over the deployed applications and possiblyapplication hosting environment configurations.

Infrastructure as a Service (IaaS): the capability provided to theconsumer is to provision processing, storage, networks, and otherfundamental computing resources where the consumer is able to deploy andrun arbitrary software, which can include operating systems andapplications. The consumer does not manage or control the underlyingcloud infrastructure but has control over operating systems, storage,deployed applications, and possibly limited control of select networkingcomponents (e.g., host firewalls).

Deployment Models are as follows:

Private cloud: the cloud infrastructure is operated solely for anorganization. It may be managed by the organization or a third party andmay exist on-premises or off-premises.

Community cloud: the cloud infrastructure is shared by severalorganizations and supports a specific community that has shared concerns(e.g., mission, security requirements, policy, and complianceconsiderations). It may be managed by the organizations or a third partyand may exist on-premises or off-premises.

Public cloud: the cloud infrastructure is made available to the generalpublic or a large industry group and is owned by an organization sellingcloud services.

Hybrid cloud: the cloud infrastructure is a composition of two or moreclouds (private, community, or public) that remain unique entities butare bound together by standardized or proprietary technology thatenables data and application portability (e.g., cloud bursting forload-balancing between clouds).

A cloud computing environment is service oriented with a focus onstatelessness, low coupling, modularity, and semantic interoperability.At the heart of cloud computing is an infrastructure that includes anetwork of interconnected nodes.

Referring now to FIG. 5, illustrative cloud computing environment 50 isdepicted. As shown, cloud computing environment 50 includes one or morecloud computing nodes 10 with which local computing devices used bycloud consumers, such as, for example, personal digital assistant (PDA)or cellular telephone 54A, desktop computer 54B, laptop computer 54C,and/or automobile computer system 54N may communicate. Nodes 10 maycommunicate with one another. They may be grouped (not shown) physicallyor virtually, in one or more networks, such as Private, Community,Public, or Hybrid clouds as described hereinabove, or a combinationthereof. This allows cloud computing environment 50 to offerinfrastructure, platforms and/or software as services for which a cloudconsumer does not need to maintain resources on a local computingdevice. It is understood that the types of computing devices 54A-N shownin FIG. 5 are intended to be illustrative only and that computing nodes10 and cloud computing environment 50 can communicate with any type ofcomputerized device over any type of network and/or network addressableconnection (e.g., using a web browser).

Referring now to FIG. 6, a set of functional abstraction layers providedby cloud computing environment 50 (FIG. 5) is shown. It should beunderstood in advance that the components, layers, and functions shownin FIG. 6 are intended to be illustrative only and embodiments of theinvention are not limited thereto. As depicted, the following layers andcorresponding functions are provided:

Hardware and software layer 60 includes hardware and softwarecomponents. Examples of hardware components include: mainframes 61; RISC(Reduced Instruction Set Computer) architecture based servers 62;servers 63; blade servers 64; storage devices 65; and networks andnetworking components 66. In some embodiments, software componentsinclude network application server software 67 and database software 68.

Virtualization layer 70 provides an abstraction layer from which thefollowing examples of virtual entities may be provided: virtual servers71; virtual storage 72; virtual networks 73, including virtual privatenetworks; virtual applications and operating systems 74; and virtualclients 75.

In one example, management layer 80 may provide the functions describedbelow. Resource provisioning 81 provides dynamic procurement ofcomputing resources and other resources that are utilized to performtasks within the cloud computing environment. Metering and Pricing 82provide cost tracking as resources are utilized within the cloudcomputing environment, and billing or invoicing for consumption of theseresources. In one example, these resources may include applicationsoftware licenses. Security provides identity verification for cloudconsumers and tasks, as well as protection for data and other resources.User portal 83 provides access to the cloud computing environment forconsumers and system administrators. Service level management 84provides cloud computing resource allocation and management such thatrequired service levels are met. Service Level Agreement (SLA) planningand fulfillment 85 provide pre-arrangement for, and procurement of,cloud computing resources for which a future requirement is anticipatedin accordance with an SLA.

Workloads layer 90 provides examples of functionality for which thecloud computing environment may be utilized. Examples of workloads andfunctions which may be provided from this layer include: mapping andnavigation 91; software development and lifecycle management 92; virtualclassroom education delivery 93; data analytics processing 94;transaction processing 95; and remote client request data handlingprocessing 96.

The descriptions of the various embodiments of the present inventionhave been presented for purposes of illustration, but are not intendedto be exhaustive or limited to the embodiments disclosed. Manymodifications and variations will be apparent to those of ordinary skillin the art without departing from the scope and spirit of the describedembodiments. The terminology used herein was chosen to best explain theprinciples of the embodiments, the practical application or technicalimprovement over technologies found in the marketplace, or to enableothers of ordinary skill in the art to understand the embodimentsdisclosed herein.

Improvements and modifications can be made to the foregoing withoutdeparting from the scope of the present invention.

What is claimed is:
 1. A computer-implemented method for handlingrequest data with type safety in a remote service, the methodcomprising: providing a data structure, wherein the data structureincludes a set of entries, wherein each entry matches an incomingrequest type with a function for handling the request, and wherein thefunction defines a set of parameters; receiving an incoming request fora service from a remote client, wherein the request includes requestdata; using the data structure to identify an entry for the incomingrequest by matching the request data to an incoming request type of anentry; converting the incoming request into a set of parameters using asoftware construct of the matching function identified in the entry,wherein the software construct comprises the matching function andassociated in-scope local variables; and running the function using theconverted parameters.
 2. The method as claimed in claim 1, wherein theincoming request type of information is stored in the softwareconstruct.
 3. The method as claimed in claim 1, wherein the softwareconstruct is a closure wrapping a programmer-defined function, whereinthe closure carries out a conversion of request data that accepts anincoming request body of data and returns a response body of data asconverted parameters for a data type.
 4. The method as claimed in claim1, wherein the data structure includes constraints on the types of dataa function will work with.
 5. The method as claimed in claim 1, whereinthe functions of the data structure are generic functions definingreusable functions that work with data types.
 6. The method as claimedin claim 1, wherein the software construct carries out a conversionbetween the programmer data types and the request body data, and whereinthe software construct stores the type data as part of a softwareconstruct code.
 7. The method as claimed in claim 1, wherein a compilercreates multiple specialized functions at compile time that apply thedata types to be executed by requests in the service.
 8. The method asclaimed in claim 1, the method further comprising: including registeringan entry in the data structure with a programmer-defined function forexposed application programming interfaces in the service.
 9. The methodas claimed in claim 1, wherein the service is a remote service withexposed application programming interfaces (APIs).
 10. The method asclaimed in claim 9, wherein the remote service is a microservice or aweb service.
 11. A system for handling request data with type safety ina remote service, comprising: a processor and a memory configured toprovide computer program instructions to the processor to execute thefunction of the components: a data structure providing component forproviding a data structure, wherein the data structure includes a set ofentries, wherein each entry matches an incoming request type with afunction for handling the request, and wherein the function defines aset of parameters; an incoming request component for receiving anincoming request for a service from a remote client, wherein the requestincludes request data; a data structure entry identifying component foridentifying an entry in the data structure for the incoming request bymatching the request data to an incoming request type of an entry; arequest parameter converting component for converting the incomingrequest into a set of parameters using a software construct of thematching function identified in the entry, wherein the softwareconstruct comprises the matching function and associated in-scope localvariables; and a function running component for running the functionusing the converted parameters.
 12. The system as claimed in claim 11,wherein the incoming request type of information is stored in thesoftware construct.
 13. The system as claimed in claim 11, wherein thesoftware construct is a closure wrapping a programmer-defined function,wherein the closure carries out a conversion of request data thataccepts an incoming request body of data and returns a response body ofdata as converted parameters for a data type.
 14. The system as claimedin claim 11, wherein the data structure includes constraints on thetypes of data a function will work with.
 15. The system as claimed inclaim 11, wherein the functions of the data structure are genericfunctions defining reusable functions that work with data types.
 16. Thesystem as claimed in claim 11, wherein the software construct carriesout a conversion between the programmer data types and the request bodydata, and wherein the software construct stores the type data as part ofa software construct code.
 17. The system as claimed in claim 11,wherein a compiler creates multiple specialized functions at compiletime that apply the data types to be executed by requests in theservice.
 18. The system as claimed in claim 11, the method furthercomprising: including registering an entry in the data structure with aprogrammer-defined function for exposed application programminginterfaces in the service.
 19. The system as claimed in claim 11,wherein the service is a remote service with exposed applicationprogramming interfaces (APIs).
 20. A computer program product forhandling request data with type safety in a remote service, the computerprogram product comprising a computer readable storage medium havingprogram instructions embodied therewith, the program instructionsexecutable by a processor to cause the processor to: provide a datastructure, wherein the data structure includes a set of entries, whereineach entry matches an incoming request type with a function for handlingthe request, and wherein the function defines a set of parameters;receive an incoming request for a service from a remote client, whereinthe request includes request data; use the data structure to identify anentry for the incoming request by matching the request data to anincoming request type of an entry; convert the incoming request into aset of parameters using a software construct of the matching functionidentified in the entry, wherein the software construct comprises thematching function and associated in-scope local variables; and run thefunction using the converted parameters.